import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

var router = new Router({
    mode: 'history',
    routes: [{
            path: '/login',
            name: '登录',
            component: () =>
                import ('@/pages/login/login')
        },
        {
            path: '/',
            name: 'home',
            component: () =>
                import ('@/components/Home'),
            redirect: '/home',
            leaf: true, // 只有一个节点
            menuShow: true,
            iconCls: 'iconfont icon-weibiaoti1', // 图标样式class
            children: [{
                path: '/home',
                component: () =>
                    import ('@/pages/home/dashboard'),
                name: '首页',
                menuShow: true
            }]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '理财项目',
            menuShow: true,
            iconCls: 'iconfont icon-xiangmu', // 图标样式class
            children: [{
                    path: '/product/zzProject',
                    component: () =>
                        import ('@/pages/productproject/zzProject'),
                    name: '债转项目列表',
                    menuShow: true
                },
                {
                    path: '/product/ztProject',
                    component: () =>
                        import ('@/pages/productproject/ztProject'),
                    name: '直投项目列表',
                    menuShow: true
                },
                {
                    path: '/product/recommend',
                    component: () =>
                        import ('@/pages/productproject/recommend'),
                    name: '推荐管理位',
                    menuShow: true
                },
                {
                    path: '/product/lender',
                    component: () =>
                        import ('@/pages/productproject/lender'),
                    name: '出借方管理',
                    menuShow: true
                },
                {
                    path: '/product/debtor',
                    component: () =>
                        import ('@/pages/productproject/debtor'),
                    name: '借款方管理',
                    menuShow: true
                },
                {
                    path: '/product/ztDebtor',
                    component: () =>
                        import ('@/pages/productproject/ztDebtor'),
                    name: '直投借款方管理',
                    menuShow: true
                },
                {
                    path: '/product/repaymentAdmin',
                    component: () =>
                        import ('@/pages/productproject/repaymentAdmin'),
                    name: '还款管理',
                    menuShow: true
                },
                {
                    path: '/product/guarantee',
                    component: () =>
                        import ('@/pages/productproject/guarantee'),
                    name: '担保人管理',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '会员管理',
            menuShow: true,
            iconCls: 'iconfont icon-huiyuanguanli', // 图标样式class
            children: [{
                    path: '/vipAdmin/vipList',
                    component: () =>
                        import ('@/pages/vipAdmin/vipList'),
                    name: '会员列表',
                    menuShow: true
                },
                {
                    path: '/vipAdmin/bankList',
                    component: () =>
                        import ('@/pages/vipAdmin/bankList'),
                    name: '银行卡列表',
                    menuShow: true
                },
                {
                    path: '/vipAdmin/bankAdmin',
                    component: () =>
                        import ('@/pages/vipAdmin/bankAdmin'),
                    name: '银行卡管理',
                    menuShow: true
                },
                {
                    path: '/vipAdmin/smsList',
                    component: () =>
                        import ('@/pages/vipAdmin/smsList'),
                    name: '短信列表',
                    menuShow: true
                },
                {
                    path: '/vipAdmin/codeList',
                    component: () =>
                        import ('@/pages/vipAdmin/codeList'),
                    name: '验证码列表',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '财务管理',
            menuShow: true,
            iconCls: 'iconfont icon-caiwuguanli', // 图标样式class
            children: [{
                    path: '/financeAdmin/detailde',
                    component: () =>
                        import ('@/pages/financeAdmin/detailde'),
                    name: '购买明细',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/interestSetment',
                    component: () =>
                        import ('@/pages/financeAdmin/interestSetment'),
                    name: '利息营收结算',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/ztInterestSetment',
                    component: () =>
                        import ('@/pages/financeAdmin/ztInterestSetment'),
                    name: '直投利息营收结算',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/rementIntetIntest',
                    component: () =>
                        import ('@/pages/financeAdmin/rementIntetIntest'),
                    name: '项目还本付息管理',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/ztRementIntetIntest',
                    component: () =>
                        import ('@/pages/financeAdmin/ztRementIntetIntest'),
                    name: '直投还本付息管理',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/capitalFlow',
                    component: () =>
                        import ('@/pages/financeAdmin/capitalFlow'),
                    name: '资金流水',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/interestRate',
                    component: () =>
                        import ('@/pages/financeAdmin/interestRate'),
                    name: '计息记录',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/ztInterestRate',
                    component: () =>
                        import ('@/pages/financeAdmin/ztInterestRate'),
                    name: '直投计息记录',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/repayment',
                    component: () =>
                        import ('@/pages/financeAdmin/repayment'),
                    name: '还款计划管理',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/ztRepayment',
                    component: () =>
                        import ('@/pages/financeAdmin/ztRepayment'),
                    name: '直投还款计划管理',
                    menuShow: true
                },
                {
                    path: '/financeAdmin/ztLoan',
                    component: () =>
                        import ('@/pages/financeAdmin/ztLoan'),
                    name: '直投放款计划管理',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '优惠管理',
            menuShow: true,
            iconCls: 'iconfont icon-youhuiquan', // 图标样式class
            children: [{
                    path: '/discountAdmin/jxqAdmin',
                    component: () =>
                        import ('@/pages/discountAdmin/jxqAdmin'),
                    name: '加息券管理',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/usejxq',
                    component: () =>
                        import ('@/pages/discountAdmin/usejxq'),
                    name: '加息券领用记录',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/redPatsAdmin',
                    component: () =>
                        import ('@/pages/discountAdmin/redPatsAdmin'),
                    name: '红包管理',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/useRedPats',
                    component: () =>
                        import ('@/pages/discountAdmin/useRedPats'),
                    name: '红包领用记录',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/zjzDetailed',
                    component: () =>
                        import ('@/pages/discountAdmin/zjzDetailed'),
                    name: '正经值明细',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/dhAdmin',
                    component: () =>
                        import ('@/pages/discountAdmin/dhAdmin'),
                    name: '兑换管理',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/userDHList',
                    component: () =>
                        import ('@/pages/discountAdmin/userDHList'),
                    name: '用户兑换列表',
                    menuShow: true
                },
                {
                    path: '/discountAdmin/txjl',
                    component: () =>
                        import ('@/pages/discountAdmin/txjl'),
                    name: '提现券记录',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '配置管理',
            menuShow: true,
            iconCls: 'iconfont icon-peizhishujuyuan',
            children: [{
                    path: '/config/ggwList',
                    component: () =>
                        import ('@/pages/config/ggwList'),
                    name: '公告位列表',
                    menuShow: true
                },
                {
                    path: '/config/ggList',
                    component: () =>
                        import ('@/pages/config/ggList'),
                    name: '公告列表',
                    menuShow: true
                },
                {
                    path: '/config/friendshipList',
                    component: () =>
                        import ('@/pages/config/friendshipList'),
                    name: '友情链接列表',
                    menuShow: true
                },
                {
                    path: '/config/sjbook',
                    component: () =>
                        import ('@/pages/config/sjbook'),
                    name: '数据字典',
                    menuShow: true
                },
                {
                    path: '/config/sources',
                    component: () =>
                        import ('@/pages/config/sources'),
                    name: '渠道管理',
                    menuShow: true
                },
                {
                    path: '/config/androidVersion',
                    component: () =>
                        import ('@/pages/config/androidVersion'),
                    name: '安卓客户端版本',
                    menuShow: true
                },
                {
                    path: '/config/bankList',
                    component: () =>
                        import ('@/pages/config/bankList'),
                    name: '银行卡列表',
                    menuShow: true
                },
                {
                    path: '/config/txService',
                    component: () =>
                        import ('@/pages/config/txService'),
                    name: '提现手续费管理',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '系统管理',
            menuShow: true,
            iconCls: 'iconfont icon-xitongguanli',
            children: [{
                    path: '/system/adminUserList',
                    component: () =>
                        import ('@/pages/system/adminUserList'),
                    name: '管理员列表',
                    menuShow: true
                },
                {
                    path: '/system/userList',
                    component: () =>
                        import ('@/pages/system/userList'),
                    name: '角色列表',
                    menuShow: true
                },
                {
                    path: '/system/qxList',
                    component: () =>
                        import ('@/pages/system/qxList'),
                    name: '权限列表',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '数据统计',
            menuShow: true,
            iconCls: 'iconfont icon-shujutongji',
            children: [{
                    path: '/dataStatistics/dataFX',
                    component: () =>
                        import ('@/pages/dataStatistics/dataFX'),
                    name: '数据分析',
                    menuShow: true
                },
                {
                    path: '/dataStatistics/dataStacs',
                    component: () =>
                        import ('@/pages/dataStatistics/dataStacs'),
                    name: '数据统计',
                    menuShow: true
                },
                {
                    path: '/dataStatistics/sourcesTJ',
                    component: () =>
                        import ('@/pages/dataStatistics/sourcesTJ'),
                    name: '渠道统计',
                    menuShow: true
                },
                {
                    path: '/dataStatistics/dayTJ',
                    component: () =>
                        import ('@/pages/dataStatistics/dayTJ'),
                    name: '按日统计',
                    menuShow: true
                }
            ]
        },
        {
            path: '/',
            component: () =>
                import ("@/components/Home"),
            name: '设置',
            menuShow: true,
            iconCls: 'iconfont icon-shezhi',
            children: [{
                    path: '/user/profile',
                    component: () =>
                        import ('@/pages/user/profile'),
                    name: '个人信息',
                    menuShow: true
                },
                {
                    path: '/user/changepwd',
                    component: () =>
                        import ('@/pages/user/changepwd'),
                    name: '修改密码',
                    menuShow: true
                }
            ]
        },
        // {
        //     path: '/',
        //     component: () =>
        //         import ("@/components/Home"),
        //     name: '图书管理',
        //     menuShow: true,
        //     iconCls: 'iconfont',
        //     children: [{
        //             path: '/book/list',
        //             component: () =>
        //                 import ('@/pages/book/list'),
        //             name: '图书列表',
        //             menuShow: true
        //         },
        //         {
        //             path: '/book/category',
        //             component: () =>
        //                 import ('@/pages/bookcategory/list'),
        //             name: '图书分类',
        //             menuShow: true
        //         }
        //     ]
        // }
    ]
})

// router.beforeEach((to, from, next) => {
//     console.log('to:' + to.path)
//     if (to.path.startsWith('/login')) {
//         window.localStorage.removeItem('access-user')
//         next()
//     } else {
//         let user = JSON.parse(window.localStorage.getItem('access-user'))
//         if (!user) {
//             next({ path: '/login' })
//         } else {
//             next()
//         }
//     }
// })

export default router